import java.awt.Color;
import java.awt.Graphics;
import java.awt.Point;
import java.util.List;

import javax.swing.JFrame;
import javax.swing.JPanel;

public class WhiteBoard extends JPanel {

	/**
	 * 
	 */
	private static final long serialVersionUID = -5678354039505419056L;
	WhiteBoardModel model;

	public WhiteBoard(WhiteBoardModel m, String title) {
		super();
		model = m;
//		JFrame f = new JFrame(title);
//		f.setAlwaysOnTop(true);
//		f.add(this);
//		f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//		f.setSize(400, 400);
//		f.setVisible(true);
	}

	public void paint(Graphics g) {
		// TODO
		g.clearRect(0, 0, getWidth(), getHeight());

		List<Line> lst = model.getLines();
		for (int i = 0; i < lst.size(); i++) {
			Line l = lst.get(i);
			Color c = l.color;
			g.setColor(c);
			g.drawLine(l.start.x, l.start.y, l.end.x, l.end.y);
		}

	}
}
